package gui;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Scanner;

public class LangMgr {
	private HashMap<String, String> strings = new HashMap<String, String>();
	private static LangMgr instance = null;
	
	private LangMgr()
	{
		try {
			Scanner s = new Scanner(new File("srpski-gui.txt"));
			while(s.hasNext())
			{
				String key = s.nextLine();
				String value = s.nextLine();
				
				strings.put(key, value);
			}
			s.close();
		} catch (FileNotFoundException e) {}
	}
	
	private static LangMgr get()
	{
		if(instance == null) instance = new LangMgr();
		return instance;
	}
	
	public static String getString(String key)
	{
		String val = get().strings.get(key);
		if(val == null)
			return key;
		else
			return val;
	}
}
